package com.paypalpay.util;

import com.paypalpay.pojo.Constant;
import com.paypalpay.util.wx.SHA;

public class ControllerUtil {

    private String requestSignature(String refNo, String amount, String currency) {
        StringBuffer buffer = new StringBuffer();

        buffer.append(Constant.MERCHANT_KEY);
        buffer.append(Constant.MERCHANT_CODE);
        buffer.append(refNo);
        // Amount中去掉,或者.
        buffer.append(amount.replace(".", "").replace(",", ""));
        buffer.append(currency);
        System.out.println("==========加密前的值：" + buffer.toString());
        // SHA1加密，计算出hash值作为Signature的参数值
        String result = SHA.encrypt(buffer.toString());
        System.out.println("==========加密后的值：" + result);
        return result;
    }

}
